package com.wlb365.financing.config;

import com.wlb365.financing.properties.AdminProperties;
import com.wlb365.sdk.client.SdkClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * 概述：web配置
 * </p>
 *
 * @author zwh
 * @version 1.0
 * @copyRight 北京微利宝信息技术有限公司  All right reserved.
 * @date 2020/3/21
 */
@Configuration
public class WebConfig {

    @Bean
    @ConfigurationProperties(prefix = "wlb")
    public AdminProperties adminProperties() {
        return new AdminProperties();
    }

    @Autowired
    private AdminProperties adminProperties;

    @Bean
    public SdkClient sdkClient() {
        return new SdkClient(adminProperties.getSdk().getUrl(), adminProperties.getSdk().getAppId()
                , adminProperties.getSdk().getPrivateKey()
                , adminProperties.getSdk().getPublicKey()
        );
    }

}